#pragma once
#include "../engine/dynamicarray.h"
#include "../math/MeshObject.h"
#include "../math/TriangleSurface.h"

class ImportTriangleMesh {

    private:

        DynamicArray<ushort> indices;
        DynamicArray<ushort> vertsperfaces;
        DynamicArray<Vector4> vertices;
        DynamicArray<TriangleSurface> triangles;

        void Import(char* filepath);
        void CreateTriangle(uint current, MeshObject& mobject);
        void CreateTriangleSquare(uint current, MeshObject& mobject);

    public:

        // -- lifetime
        ImportTriangleMesh(char* filename);

        // -- public interface
        MeshObject GetMesh();
};

// ================================================================================================
// Default constructor
// ================================================================================================
inline ImportTriangleMesh::ImportTriangleMesh(char* filename) : indices(), vertsperfaces(), 
                                                                vertices(), triangles() {
    Import(filename);
}
